package easy;

public class offer10_1斐波那契数列 {
    public int fib(int n) {
        int a=0,b=1,sum=0;
        if (n == 0) {
            return a;
        }
        if (n == 1) {
            return b;
        }
        for(int i=2;i<=n;i++){
            sum=(a+b)%1000000007;
            a=b;
            b=sum;
        }
        return b;
    }
}
